package com.uchedao.seller.util;

import android.content.Context;
import android.content.SharedPreferences;

import java.util.Map;

public class PreferenceUitl {
	public String mPreferenceName = "cjd";
	private Context mContext;
	private SharedPreferences.Editor mEditor;
	private SharedPreferences mPreferences;

	public PreferenceUitl(Context context, String preferenceName, int mode) {
		this.mContext = context;
		this.mPreferenceName = preferenceName;
		this.mPreferences = this.mContext.getSharedPreferences(mPreferenceName, mode);
		this.mEditor = this.mPreferences.edit();
	}

	public void destroy() {
		this.mContext = null;
		this.mPreferences = null;
		this.mEditor = null;
	}

	public boolean getBoolean(String paramString, boolean paramBoolean) {
		return this.mPreferences.getBoolean(paramString, paramBoolean);
	}

	public boolean getBoolean(String paramString) {
		return this.mPreferences.getBoolean(paramString, false);
	}

	public int getInt(String paramString, int paramInt) {
		return this.mPreferences.getInt(paramString, paramInt);
	}

	public int getInt(String paramString) {
		return this.mPreferences.getInt(paramString, 0);
	}

	public long getLong(String paramString, long paramLong) {
		return this.mPreferences.getLong(paramString, paramLong);
	}

	public long getLong(String paramString) {
		return this.mPreferences.getLong(paramString, 0);
	}

	public String getString(String paramString1, String paramString2) {
		return this.mPreferences.getString(paramString1, paramString2);
	}

	public String getString(String paramString1) {
		return this.mPreferences.getString(paramString1, null);
	}

	public boolean contains(String key) {
		return mPreferences.contains(key);
	}

	public Map<String, ?> getAll() {
		return this.mPreferences.getAll();
	}

	public void clear() {
		this.mEditor.clear().commit();

	}

	public void remove(String paramString) {
		this.mEditor.remove(paramString).commit();
	}

	public void putBoolean(String paramString, boolean paramBoolean) {
		this.mEditor.putBoolean(paramString, paramBoolean).commit();
	}

	public void putInt(String paramString, int paramInt) {
		if (this.mEditor != null) {
			this.mEditor.putInt(paramString, paramInt).commit();
		}
	}

	public void putLong(String paramString, long paramLong) {
		this.mEditor.putLong(paramString, paramLong).commit();
	}

	public void putString(String paramString1, String paramString2) {
		this.mEditor.putString(paramString1, paramString2).commit();
	}

	// public void putStringSet(String paramString, Set<String> set) {
	// mEditor.putStringSet(paramString, set).commit();
	// }
}
